<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<c:set value="${pageContext.request.contextPath}" var="path" scope="page"/>
<!DOCTYPE html>
<html>

<head>
    <title>后台管理系统</title>
    <link rel="stylesheet" href="../../../backstage/css/x-admin.css" media="all">
    <script src="../../../backstage/js/jquery.min.js"></script>
    <script src="../../../backstage/lib/layui/layui.js" charset="utf-8"></script>
    <script src="../../../backstage/js/x-admin.js"></script>
    <script src="../../../backstage/js/x-layui.js" charset="utf-8"></script>
<style>

    .demo{
        /*width: 400px;*/
        margin: 12px auto;
        /*border: 1px solid #596480;*/
        color: #8ca9cd;
        /*background:url(../../../backstage/images/bg.jpg);*/
        text-align: center;
    }
    .demo p{text-align: center;
        margin: 24px;
        text-indent: 0}
    #demo-5{height: 300px;
        position: static;
        *position: relative;
        display:table;
        font-size:xx-large; }
    /*#demo-5 div{*position: absolute;*top: 50%;*left: 0}*/
    #demo-5 p{position: relative;
        *top: -50%}
    #demo-5>div{display:table-cell;
        vertical-align:middle;
        position:static}
</style>

</head>

<body>
    <div class="layui-layout layui-layout-admin">
        <div class="layui-header header header-demo">
            <div class="layui-main">
                <div class="admin-logo-box">
                    <a class="logo" href="" title="logo">宠物保险管理系统</a>
                </div>
                <ul class="layui-nav" lay-filter="">
                    <li class="layui-nav-item">
                        <a href="" title="消息">
                            <i class="layui-icon" style="top: 1px;">ဂ</i>
                        </a>
                    </li>
                    <li class="layui-nav-item">
                        <a id="logout" href="javascript:;" >退出</a>
                    </li>
                    <li class="layui-nav-item x-index"><a  id="chatRoom" href="javascript:;">聊天室</a></li>
                </ul>
            </div>
        </div>
        <!--左侧导航区域-->
        <div class="layui-side layui-bg-black x-side show_list" style="left:0px;" id="table1">
            <div style="height: 130px; width: 220px; " class="head-img">
                <a class="img" title="我的头像" id="sculpture">
                    <img src="../../../backstage/images/logo.png" class="userAvatar" id="img_sculpture">
                </a>
                <p id="img_p">
                    你好！<span class="userName">${user.username}</span>
                </p>
            </div>
            <div class="layui-side-scroll">
                <ul class="layui-nav layui-nav-tree site-demo-nav" lay-filter="side">
                    <c:forEach items ="${powers}" var="power">
                        <c:if test="${power==\"用户管理员\"}">
                            <li class="layui-nav-item">
                                <a class="javascript:;">
                                    <cite>用户管理</cite>
                                </a>
                                <dl class="layui-nav-child">
                                    <dd class="">
                                    <dd  class="">
                                        <a href="javascript:;" _href="${path}/admin/userList"> <cite>用户列表</cite> </a>
                                    </dd>
                                    </dd>
                                </dl>
                            </li>
                        </c:if>
                        <c:if test="${power==\"商品管理员\"}">

                            <li class="layui-nav-item">
                            <a class="javascript:;" href="javascript:;">
                                <cite>商品管理</cite>
                            </a>
                                <dl class="layui-nav-child">
                                    <dd class="">
                                    <dd class="">
                                        <a href="javascript:;" _href="${path}/admin/itemList"> <cite>商品列表</cite> </a>
                                    </dd>
                                    </dd>
                                </dl>
                            </li>
                        </c:if>
                        <c:if test="${power==\"订单管理员\"}">
                            <li class="layui-nav-item">
                                <a class="javascript:;" href="javascript:;">
                                    <cite>订单管理</cite>
                                </a>
                                <dl class="layui-nav-child">
                                    <dd class="">
                                    <dd class=""> <a href="javascript:;" _href="${path}/admin/billList"> <cite>订单列表</cite> </a> </dd>
                                    </dd>
                                </dl>
                            </li>
                        </c:if>
                        <c:if test="${power==\"权限分配管理员\"}">
                            <li class="layui-nav-item">
                                <a class="javascript:;" href="javascript:;">
                                    <cite>管理员权限管理</cite>
                                </a>
                                <dl class="layui-nav-child">
                                    <dd class=""> <a href="javascript:;" _href="${path}/admin/powerList"> <cite>权限列表</cite> </a> </dd>
                                </dl>
                            </li>
                        </c:if>
                        <c:if test="${power==\"会员管理员\"}">
                            <li class="layui-nav-item">
                                <a class="javascript:;" href="javascript:;">
                                    <cite>会员管理</cite>
                                </a>
                                <dl class="layui-nav-child">
                                    <%--<dd class=""> <a href="javascript:;" _href="./associator-list.jsp"> <cite>会员列表</cite> </a> </dd>--%>
                                    <dd class=""> <a href="javascript:;" _href="${path}/admin/creditList"> <cite>积分列表</cite> </a> </dd>
                                    <dd class=""> <a href="javascript:;" _href="${path}/admin/couponList"> <cite>优惠券列表</cite> </a> </dd>
                                    <%--<dd class=""> <a href="javascript:;" _href="./level-list.jsp"> <cite>特权列表</cite> </a> </dd>--%>
                                </dl>
                            </li>
                        </c:if>
                        <c:if test="${power==\"系统管理员\"}">
                            <li class="layui-nav-item">
                                <a class="javascript:;" href="javascript:;">
                                    <cite>系统管理</cite>
                                </a>
                                <dl class="layui-nav-child">
                                    <dd class=""> <a href="javascript:;" _href="${path}/admin/statistics"> <cite>系统统计数据</cite> </a> </dd>
                                </dl>
                            </li>
                                </c:if>
                    </c:forEach>

                    <li class="layui-nav-item" style="height: 30px; text-align: center"> </li>
                </ul>
        </div>
        <div class="layui-tab layui-tab-card site-demo-title x-main" lay-filter="x-tab" lay-allowclose="true" style="left: 220px;border-left: solid 2px #2299ee;">
            <ul class="layui-tab-title">
                <li class="layui-this"> 管理员
                    <i class="layui-icon layui-unselect layui-tab-close" >ဆ</i>
                </li>
            </ul>
            <%--!-- 显示的是welcome-admin的内容--%>
            <div class="layui-tab-content site-demo site-demo-body">
                <div class="layui-tab-item layui-show">
                    <iframe frameborder="0" src="${path}/admin/welcome" class="x-iframe"></iframe>
                </div>
            </div>
        </div>
            <%--<div class="layui-tab-content site-demo site-demo-body">--%>
                <%--<div class="layui-tab-item layui-show">--%>
                    <%--<div class="demo" id="demo-5" >--%>
                        <%--<div>--%>
                        <%--<p >--%>
                            <%--你好！<span class="userName">${user.username}</span>--%>
                        <%--</p>--%>
                        <%--<p>--%>
                        <%--欢迎使用后台管理系统！--%>
                        <%--</p>--%>
                        <%--</div>--%>
                        <%--</div>--%>
                    <%--</div>--%>
                <%--</div>--%>
        <%--</div>--%>

    </div>
        </div><!-- <div class="site-mobile-shade"> </div> -->
    <script>
    layui.use(['laydate', 'element', 'laypage', 'layer'], function() {
        $ = layui.jquery; //jquery
        laydate = layui.laydate; //日期插件
        lement = layui.element(); //面包导航
        laypage = layui.laypage; //分页
        layer = layui.layer; //弹出层


            var user="<%=session.getAttribute("user")%>";

            $("#logout").click(function(){
                var username = "${user.username}";
                $.ajax({
                    type: 'POST',
                    url: '/userManager/logout',
                    dataType: "json",
                    data: {},
                    error: function () {
                        console.log("失败");
                    },
                    success: function (data) {
                        alert("已退出账号，如有需要，请重新登录");
                        window.location.href = '${path}/loginAdmin';
                    }
                });
        });

        $("#chatRoom").click(function(){
            var role = "${user.role}";
                if(role=="客服"){
                    window.open ("${path}/chat?role=kfjs");
                }
            if(role=="管理员"){
                alert("您无权限跳转到前台页面！")
            }
            });
    });
    </script>
</body>

<style>
    .show_list {
        display: block;
    }

    .hide_lits {
        display: none;
    }

    #sculpture {
        display: block;
        width: 80px;
        height: 80px;
        margin: 10px auto 10px;
    }

    #img_sculpture {
        display: block;
        width: 100%;
        height: 100%;
        border-radius: 50%;
        -webkit-border-radius: 50%;
        -moz-border-radius: 50%;
        border: 4px solid #44576b;
        box-sizing: border-box;
    }

    #img_p {
        display: block;
        width: 100%;
        height: 25px;
        color: #ffffff;
        text-align: center;
        font-size: 12px;
        white-space: nowrap;
        line-height: 25px;
        overflow: hidden;
    }
</style>

</html>